<?php
Yii::app()->clientScript->registerScriptFile($this->staticsPath."/frontend/js/jquery.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->staticsPath."/js/bootstrap.min.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerCssFile($this->staticsPath."/css/global.css");
Yii::app()->clientScript->registerCssFile($this->staticsPath."/css/index.css");
Yii::app()->clientScript->registerCssFile($this->staticsPath."/css/font-awesome.min.css");
Yii::app()->clientScript->registerCssFile($this->staticsPath."/Font-Awesome-3.2.1/css/font-awesome.min.css");
Yii::app()->clientScript->registerCssFile($this->staticsPath."/css/bootstrap.min.css");

Yii::app()->clientScript->registerCss("CSS1","
    .cont_box img{
        height: 200px;
    }

   #loadings {
        left: 50%;
        position: absolute;
        top: 50%;
    }

");


?>
<style type="text/css">
    .main-box {

        height: 100%;
        left: 0;
        margin: 0 auto;
        position: absolute;
        top: 0;
        width: 100%;
        z-index: -1;
    }
    .morcon {
        height: 100px;
        margin: 245px 20px 20px;
        position: relative;
        text-align: center;
    }

    .morcon .reg {
        background: rgba(255, 255, 255, 0) none repeat scroll 0 0;
        border: medium none;
        color: #fff;
        font-size: 20px;
        left: 4%;
        position: absolute;
        top: 0;
    }
    .morcon .login {
        background: rgba(255, 255, 255, 0) none repeat scroll 0 0;
        border: medium none;
        color: #fff;
        display: block;
        font-size: 20px;
        left: 51%;
        position: absolute;
        top: 39%;
    }

    .wrap .header{
        width: 100%;
        position: relative;
        height: 300px;
    }
    .wrap .footer {
        height: 300px;
        position: relative;
        width: 100%;
    }

    .wrap .header .mydodo{
        background: url("<?php echo $this->staticsPath."/img/mydodo.png" ?>") no-repeat scroll 0 0 / 150px auto;
        height: 40px;
        width: 150px;
        position: absolute;
        right: 15px;
        top: 25px;
    }
    .wrap .header .imgbg{
        background: url("<?php echo $this->staticsPath."/img/imgbg.png" ?>") no-repeat scroll 0 0 / 150px auto;
        height: 150px;
        width: 150px;
        position: absolute;
        left: 15px;
        top: 90px;
    }
    .imgbg .box{
        width: 100%;
        height: 100%;
        position: relative;
    }
    .imgbg .box img {
        border-radius: 50%;
        height: 80%;
        left: 15px;
        position: absolute;
        top: 15px;
        width: 80%;
    }
    .wrap .header .hname {
        height: 200px;
        left: 170px;
        position: absolute;
        top: 144px;
        width: 200px;
    }
    .wrap .header .hname p{
        color: #0066b3;
        font-size: 20px;
    }
    .wrap .header .list {


        height: 80px;
        left: 25px;
        position: absolute;
        top: 25px;
        width: 80px;
    }
    .wrap .header .list a{
        color: #0066b3;
        font-size: 30px;
    }
    .wrap .footer .fbotton{
        width: 33%;
        height: 150px;
        float: left;
    }
    .child_zw{
        cursor:pointer;
    }
    .wrap .footer .fbotton .like{
        background: url("<?php echo $this->staticsPath."/img/mylike.png" ?>") no-repeat scroll 13px 0 / 90px auto;
        height: 100%;
        width: 100%;
    }
    .wrap .footer .fbotton .collection{
        background: url("<?php echo $this->staticsPath."/img/mycollection.png" ?>") no-repeat scroll 13px 0 / 104px auto;
        height: 100%;
        width: 100%;
    }
    .wrap .footer .fbotton .share{
        background: url("<?php echo $this->staticsPath."/img/share.png" ?>") no-repeat scroll -2px 15px / 114px auto;
        height: 100%;
        width: 100%;
    }
    .wrap .footer .fbotton .point{
        background: url("<?php echo $this->staticsPath."/img/point.png" ?>") no-repeat scroll 6px 0 / 104px auto;
        height: 100%;
        width: 100%;
    }
    .wrap .footer .fbotton .pointlist{
        background: url("<?php echo $this->staticsPath."/img/pointlist.png" ?>") no-repeat scroll 13px 0 / 90px auto;
        height: 100%;
        width: 100%;
    }
    .wrap .footer .fbotton .pointgift{
        background: url("<?php echo $this->staticsPath."/img/pointgift.png" ?>") no-repeat scroll 13px 11px / 90px auto;
        height: 100%;
        width: 100%;
    }
    body{
        background: #f4f4f4 none repeat scroll 0 0;
    }
    .topban{
        padding: 0 10px
    }
    .topban .top {
        color: #888;
        height: 20px;
        left: 50%;
        line-height: 20px;
        margin: -10px 0 52px -30px;
        position: absolute;
        top: 50%;
    }
    .topban .top.name {
        margin-top: -30px;
    }
    .topban .top.num {
        margin-top: -5px;
    }
    .topban .top.subject {
        margin-top: 20px;
    }
    #logout{
        color: #ffffff;
        font-size: 18px;
    }
    #logout:hover{
        color: #ffffff;
    }
    .lgt{
        background: rgb(231,66,60);
        border-radius: 8px;
        display: inline-block;
        float: right;
        height: 50px;
        line-height: 50px;
        margin: 15px 0 88px;
        text-align: center;
        width: 40%;
    }
    .right{
        float: right;
        margin-top: 10px;
    }
    .wrap .fa{
        width: 36px;
    }
    section a {
        color:#999
    }
    .modl_tel {
        background: #ffffff none repeat scroll 0 0;
        border-bottom: 1px solid #ccc;
        height: 60px;
        line-height: 60px;
        margin: 10px 0;
        padding-left: 10px;
    }
    .topban {
        padding: 0 10px;
    }
    .topban {
        background-color: #ffffff;
        overflow: hidden;
        position: relative;
        width: 100%;
    }
    .topban {
        background: #fff none repeat scroll 0 0;
        height: 140px;
        overflow: unset;
        position: relative;
        width: 100%;
    }
    .status-people-pic {
        left: 0;
        margin-left: 15px;
        margin-top: -50px;
        position: absolute;
        top: 50%;
    }
    .stat-people {
        background: #fafafa none repeat scroll 0 0;
        border-radius: 30em;
        display: block;
        padding: 7px;
        position: relative;
        width: 100px;
    }
    .topban {
        overflow: unset;
        position: relative;
        width: 100%;
    }
    .nav {
        background: rgb(249, 249, 249) none repeat scroll 0 0;
        border-top: 1px solid #ddd;
        bottom: 0;
        opacity: 0.9;
        padding: 6px 0 !important;
        position: fixed;
        width: 100%;
        height: 55px;
    }
    .nav .nav-box {
        color: #333;
        float: left;
        font-size: 14px;
        text-align: center;
        width: 50%;
        height: 100%;
    }
    .nav .nav-box.actt{
        color: #068043;
    }

    .topban {
        overflow: unset;
        padding: 20px;
        position: relative;
        width: 100%;
    }
    .lgt.ok {
        background: #068043 none repeat scroll 0 0;
        border-radius: 8px;
        display: inline-block;
        float: left;
        height: 50px;
        line-height: 50px;
        margin: 15px 0 88px;
        text-align: center;
        width: 40%;
    }

    .wrap {
        padding: 0 20px;
        position: relative;
    }
    .jt {
        border: 1px solid #101010;
        font-size: 16px;
        height: 5rem;
        line-height: 5rem;
        margin: 20px auto 0;
        text-align: center;
        width: 10rem;
    }
    .child_box {
        margin-top: 30px;
        width: 100%;
    }
    .child_box .child_zw {
        border: 0 none;
        float: left;
        height: 6rem;
        margin: 0 0 20px;
        padding: 0 5px;
        width: 20%;
    }
    .child_box .child_zw .zw{
        width:50%;
        height: 3rem;
        border: 1px solid #111111;
        float:left;
    }
    .btn_footer {
        margin: 0 auto;
        padding: 0 30px;
    }
    .zw_name span {
        display: block;
        text-align: center;
        width: 100%;
    }
    .btn_footer a{
        color: #ffffff;
        font-size:18px
    }
    .child_box .child_zw .zw {
        border: 1px solid #111111;
        float: left;
        height: 3rem;
        width: 100%;
    }
    .child_box .child_zw {
        border: 0 none;
        float: left;
        height: 6rem;
        margin: 0 0 20px;
        padding: 0 5px;
        width: 16%;
    }
</style>

<div class="data">
    <header class="homeHder header">

        





        <div class="hder_logo">课程观测</div>
        <div class="hder_urse flor"><a  id="logOut"  href="javascript:void(0);"><i class="fa fa-sign-out"></i></a></div>
        <script type="text/javascript">
            $(function(){
                $("#logOut").click(function(){
                    if(window.confirm('你确定要退出吗？')){
                        $.ajax({
                            type: "POST",
                            url: '<?php echo Yii::app()->createUrl('observation/logOut') ?>',
                            data: {
                                'openid':'<?php echo $openid ?>'
                            },
                            dataType: "json",
                            success: function (data) {
                                if (data) {
                                    if(data.status==1){
                                        window.location.reload();
                                    }else{
                                        alert(data.message);
                                        return false;
                                    }
                                }else{
                                    alert('操作失败');
                                    return false;
                                }
                            }
                        });
                    }
                });
            });
        </script>
    </header>
    <section class="wrap">

        <div class="jt">讲台</div>
        <div class="child_box" id="child_box">
            <?php
            for ($x=1; $x<=7; $x++) {
                for ($y=1; $y<=6; $y++) {
            ?>
            <?php
            $strleft = 'left'.$x.$y;

            $$strleft = OpenOrder::model()->find('oid=:oid and x=:x and y=:y and type=:type',array(':oid'=>$id,':x'=>$x,':y'=>$y,':type'=>'left'));

            ?>
            <div id="zw<?php echo $x ?><?php echo $y ?>" data-x="<?php echo $x ?>" data-y="<?php echo $y ?>" data-left-id="<?php echo $$strleft->id ?>" data-left-name="<?php echo $$strleft->user_name ?>" class="child_zw">
                <div class="zw"></div>
                <div class="zw_name">
                    <?php
                        if($$strleft ){
                    ?>
                        <?php if($$strleft){ ?>
                                <span><?php echo $$strleft->user_name ?></span>
                        <?php }else{ ?>
                                <span></span>
                        <?php } ?>
                    <?php }else{ ?>
                        <span>未添加</span>
                    <?php } ?>
                </div>
            </div>
            <?php
                }
            }
            ?>
            <div class="clearfix"></div>
        </div>
        <div class="btn_footer">
            <?php if($open_info->status==0){ ?>
            <a  href="javascript:void(0);"><div id="start_open" style="width: 100%" class="lgt ok">课程开始</div></a>
            <?php }elseif($open_info->status==1){ ?>
                <a  href="javascript:void(0);"><div class="lgt ok">已开始</div></a>
                <a  href="javascript:void(0);"><div  id="end_open" class="lgt">课程结束</div></a>
            <?php }else{ ?>
                <a  href="javascript:void(0);"><div  style="width: 100%;background: #5e5e5e" class="lgt">课程已结束</div></a>
            <?php } ?>

            <div class="clearfix"></div>
        </div>
        <script type="text/javascript">
            var slock = true;
            $("#end_open").click(function(){
                if(slock == false){
                    return false;
                }
                $.ajax({
                    type: "POST",
                    url: '<?php echo $this->createUrl('ajaxOpenEnd'); ?>',
                    data: {
                        oid:'<?php echo $open_info->id ?>',
                    },
                    dataType: "json",
                    beforeSend: function() {
                        slock = true;
                    },
                    success: function (data) {
                        if (data) {
                            if(data.status==1){
                                Xalert(data.message);
                                setTimeout(function(){
                                    window.location.reload();
                                },2000)
                            }else{
                                Xalert(data.message);
                                return false;
                            }
                        }else{
                            Xalert('操作失败');
                            return false;
                        }
                    }
                });

            });

        </script>
    </section>
    <nav class="nav">
        <a href="javascript:void(0);" class="">
            <div class="nav-box actt">
                <i class="fa fa-book"></i>座位表
            </div>
        </a>
        <a href="javascript:void(0);" id="pj" class="">
            <div class="nav-box">
                <i class="fa fa-home"></i>评价
            </div>
        </a>
    </nav>
</div>
<script type="text/javascript">
    $(function(){
        $(function(){
            $("#pj").click(function(){
                checlOpen('2');
            });
            function checlOpen(type){
                $.ajax({
                    type: "POST",
                    url: '<?php echo $this->createUrl('ajaxCheckOpen'); ?>',
                    data: {
                        oid:'<?php echo $open_info->id ?>'
                    },
                    dataType: "json",
                    success: function (data) {
                        if (data) {
                            if(data.status==1){
                                Xalert('课程还没有结束无法查看评价');
                                return false;

                            }else if(data.status==2){
                                window.location.href="<?php echo $this->createUrl('accounting',array('id'=>$open_info->id,'openid'=>$openid)); ?>";
                                return false;
                            }
                            else{
                                Xalert('课程还没有结束无法查看评价');
                                return false;
                            }
                        }else{
                            Xalert('操作失败');
                            return false;
                        }
                    }
                });
            }
        });
    })
</script>
<div class="modal fade" id="Xalert" data-id="1" tabindex="-1" role="dialog" aria-labelledby="linkModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <!-- 登陆页面注册提示 -->
        <div class="modal-content text-left">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">提示</h4>
            </div>
            <div class="modal-body">
                <p id="alertMassage"></p>
                <button type="button" style="margin-top: 20px" class="btn btn-primary" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    function Xalert(html){
        $("#alertMassage").html(html);
        $("#Xalert").modal();
        setTimeout(function(){$("#Xalert").modal('hide')},2000);
    }
    $(function(){

    })
</script>
